import request from '@/config/axios'

export interface DocVO {
  id: number
  name: string
  code: string
  docType: string
  docNoPrefix: string
  docNoType: number
  docNoLength: number
  transactionType: number
  controlAcceptOevr: number
  controlAcceptShort: number
  controlIssueOevr: number
  controlIssueShort: number
  autoApprove: number
  printId: number
  status: number
  sort: number
  remark: string
  revision: number
}

// 查询仓储单据分页
export const getDocPage = async (params) => {
  return await request.get({ url: `/wms/doc/page`, params })
}

// 查询仓储单据详情
export const getDoc = async (id: number) => {
  return await request.get({ url: `/wms/doc/get?id=` + id })
}

// 生成单据编号
export const getDocNo = async (id: number) => {
  return await request.get({ url: `/wms/doc/get/no?id=` + id })
}

// 新增仓储单据
export const createDoc = async (data: DocVO) => {
  return await request.post({ url: `/wms/doc/create`, data })
}

// 修改仓储单据
export const updateDoc = async (data: DocVO) => {
  return await request.put({ url: `/wms/doc/update`, data })
}

// 删除仓储单据
export const deleteDoc = async (id: number) => {
  return await request.delete({ url: `/wms/doc/delete?id=` + id })
}

// 导出仓储单据 Excel
export const exportDoc = async (params) => {
  return await request.download({ url: `/wms/doc/export-excel`, params })
}
